package com.ben.multiple.aop.config;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/log")
@AllArgsConstructor
public class LogResource {
    private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(LogResource.class);

    @PostMapping
    public Log insertLog(@RequestBody Log log) {
        LOGGER.info("日志业务开始");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        LOGGER.info("日志业务结束");
        return log;
    }

}
